import React, { Component } from 'react'

export class Alter extends Component {
    constructor(props){
        super (props)
            this.state={
                flag:false,
          }
        
    }
  render() {
      const {flag}=this.state
    return (
      <div><button onClick={()=>{
          this.setState({
              flag:true
          })

      }}>打开弹框</button>
          {
              flag ? <div className='mask'>
                  <div className='cont'>
                     <span onClick={ ()=>{
                         this.setState({
                         flag:false
                     }) 
                     } }>x</span>
                 这是一个弹框  
                  </div>
                
              </div> : null
          }
          
          
          </div>
    )
  }
}

export default Alter